﻿#region Credits (Global)
//
// * Credits to WuzzMonk - for template which was rewritten by me, mostly to learn the placements, splitting files and internal functions
// * Credits to BeastMasterTree for peek at how a GUI should work which I used to get mine working
// * Credits to Jimmy06 for the Layout and Spacing of the Checkboxes/Labels etc

#endregion

#region System Namespaces
using System.Threading;
#endregion

#region Styx Namespaces
using Styx;
using Styx.Common;
using Styx.CommonBot;
using Styx.CommonBot.Routines;
#endregion

#region Known Issues - Updated 20/10/2012
//
//
//
//
//
//
//
//
#endregion

#region Windwalker Glyphs
//  Major
// -------
//
// Glyph of Zen Meditation
// Glyph of Sparring
// Glyph of Crackling Jade Lightning
//
//  Minor
// -------
//
// Glyph of Blackout Kick
// Glyph of Honor
// Glyph of Flying Serpent Kick (May change in future)
//
#endregion

#region Windwalker Talent Spec
// 15 - Celerity
// 30 - Zen Sphere
// 45 - Power Strikes
// 60 - Leg Sweep
// 75 - Dampen Harm
// 90 - Xuen, The White Tiger
#endregion

#region Information

#region Single Target Rotation
//      
//    [Spell Name] - [Type] - [Me or Target] - [Cast Type] - [Other Info]


//    Rising Sun Kick - Aura - Target - Always Up  
//    Combo Breaker: Tiger Power - Buff - Me - Always Use - Free Proc
//    Combo Breaker: Blackout Kick - Buff - Me - Always Use - Free Proc
//    Zen Sphere - Spell - Me - Use on CD
//    Fists of Fury - Spell - Target - Use on CD
//    Tiger Palm/Blackout Kick - Spell - Target - Use on Certain % 
//    Expel Harm - Spell - Me - Use on Low Health
//    Jab - Spell - Target - Constant when not casting, for Chi
//    Energizing Brew on Low Energy
//
#endregion

#region AoE Target Rotation
//      
//    [Spell Name] - [Type] - [Me or Target] - [Cast Type] - [Other Info]


//    Rising Sun Kick - Aura - Target - Always Up
//    Fists of Fury - Spell - Target - Use on CD
//    Spinning Crane Kick - Spell - Target - When Can
//    Jab - Spell - Target - Constant when not casting, for Chi
//   
//    
//   
//    
//    
//
#endregion

#region Specific Class Rotation
//
//
//  
//  
//
//
//
//
//
#endregion

#region Information About Spells/Auras/etc
//
//
//  
//  
//  
//  
// 
// HasSpell(124490) is the Touch of Death on players below 10% HP insta kill
// Change priority for Tiger Palm, as it is being cast too often while the CD is almost new (18 seconds ~)
// add banished too fleeing, and simular
// save energixing brew on low energy and low chi
// dont use spinning fire blossom on low energy because of jab energy is needed in it's place to generate chi ( would bottleneck other spells from being casted )
//
// Target and Kill totems and then get last target if totem doesn't have high hp, get names and put in spell
// Runners - Spinning Fire Blossom below 5% spam it
//
#endregion
#endregion


namespace GiwinMonk
{
    public partial class Monk : CombatRoutine
    {
        #region Routine Information
        private string Version = "0.1.1";
        public sealed override string Name { get { return "GiwinMonk - " + Version; } }
        public override WoWClass Class { get { return WoWClass.Monk; } }
        public override bool WantButton { get { return true; } }
        public override void OnButtonPress()
        {
            new GUI.Form1().ShowDialog();
        }

        #endregion
        #region Initialize
        public override void Initialize()
        {
            Logging.Write("Thank you for using GiwinMonk " + Version + "!");
        }
        #endregion
        #region PreCombat Buffs
        public override bool NeedPreCombatBuffs
        {
            get
            {
                if (!Helpers.Unit.HasMyAura(StyxWoW.Me,"Legacy of the Emperor") && !StyxWoW.Me.Combat &&
                    SpellManager.CanBuff("Legacy of the Emperor") && !Helpers.Unit.HasMyAura(StyxWoW.Me, "Blessing of Kings") &&
                    !StyxWoW.Me.Mounted && !StyxWoW.Me.IsMoving && !Helpers.Unit.HasMyAura(StyxWoW.Me, "Mark of the Wild") &&
                    !Helpers.Unit.HasMyAura(StyxWoW.Me, "Dark Intent") && !Helpers.Unit.HasMyAura(StyxWoW.Me, "Legacy of the White Tiger"))
                    return true;
                return false;
            }
        }
        public override void PreCombatBuff()
        {
            if (MIRsettings.Instance.LegacyOfTheEmperor)
                if (!Helpers.Unit.HasMyAura(StyxWoW.Me, "Legacy of the Emperor"))
                Buff("Legacy of the Emperor");
            Thread.Sleep(2000);
            if (MIRsettings.Instance.LegacyOfTheWhiteTiger)
            if (!Helpers.Unit.HasMyAura(StyxWoW.Me, "Legacy of the White Tiger"))
            Buff("Legacy of the White Tiger");
        }
        #endregion
        #region Pull
        public override void Pull()
        {
            if (StyxWoW.Me.CurrentTarget != null)
                if (StyxWoW.Me.GotTarget &&
                    StyxWoW.Me.CurrentTarget.ZDiff < MIRsettings.Instance.MaxTargetZDistance)
                    StyxWoW.Me.ToggleAttack();
                    Approach();
        }
        #endregion
        #region Combat
        public override void Combat()
        {
            if (StyxWoW.Me.CurrentTarget != null)
                if (StyxWoW.Me.GotTarget)
                    Approach();
            GeneralRotation();
        }
        #endregion
        #region Heal
        /*
        public override void Heal()
        {
            if (StyxWoW.Me.HealthPercent < 50 && !OnCooldown("Dampen Harm"))
                InstantCast("Dampen Harm");
            if (StyxWoW.Me.HealthPercent < 35 && !OnCooldown("Expel Harm"))
                InstantCast("Expel Harm");
        }
        public override void NeedHeal()
        {
                if ((StyxWoW.Me.HealthPercent < 50 && HasSpell("Dampen Harm") && !OnCooldown("Dampen Harm")) ||
                    (StyxWoW.Me.HealthPercent < 35 && HasSpell("Expel Harm") && !OnCooldown("Expel Harm")))
                    return;
        }*/

        public override bool NeedRest
        {
            get
            {
                return StyxWoW.Me.HealthPercent <= MIRsettings.Instance.RestOnHealthPercent;
            }
        }

        public override void Rest()
        {
            if (StyxWoW.Me.HealthPercent <= 50 && StyxWoW.Me.IsAlive && !StyxWoW.Me.IsSwimming)
            {
                Styx.CommonBot.Rest.Feed();
            }

        }
        #endregion
    }
}
